home *** CD-ROM | disk | FTP | other *** search
- function startKick()
- {
- if(_root.kicker_mc._currentframe == 1 && !_root.help_mc._visible)
- {
- var xp = _root.goalpost_mc._xmouse;
- var yp = _root.goalpost_mc._ymouse;
- _root.runtime.flag = "in";
- if(xp < 10 || 170 < xp || yp < 10 || 80 < yp)
- {
- _root.runtime.flag = "out";
- }
- var xregion = checkXPosition(xp);
- var yregion = checkYPosition(yp);
- if(_root.runtime.winChance >= Math.random() && _root.runtime.flag == "in")
- {
- _root.runtime.isThisAGoal = true;
- }
- _root.runtime.pos = _root.runtime.flag + "x" + xregion + "y" + yregion;
- _root.kicker_mc.gotoAndPlay("kick");
- }
- }
- function resetKick()
- {
- _root.updateDisplay();
- _root.kicker_mc.gotoAndStop(1);
- _root.ball_mc.gotoAndStop(1);
- _root.crowd_mc.gotoAndStop(1);
- _root.goalie_mc.gotoAndStop(1);
- _root.runtime.isThisAGoal = false;
- _root.runtime.crowdLoop = 0;
- }
- function kickBall()
- {
- var goaliePos = _root.runtime.pos;
- if(_root.runtime.isThisAGoal)
- {
- var goaliePos = getAnotherGoaliePos(_root.runtime.pos);
- }
- _root.ball_mc.gotoAndPlay(_root.runtime.pos);
- _root.goalie_mc.gotoAndPlay(goaliePos);
- }
- function getAnotherGoaliePos(pos)
- {
- var newPos = pos;
- xp = 3;
- while(newPos == pos || xp == 2)
- {
- var xp = Math.round(2 * Math.random() + 1);
- var yp = Math.round(1 * Math.random() + 1);
- newPos = "inx" + xp + "y" + yp;
- }
- return newPos;
- }
- function checkYPosition(yp, o1, o2)
- {
- var pos;
- if(45 >= yp)
- {
- pos = 1;
- }
- else
- {
- pos = 2;
- }
- return pos;
- }
- function checkXPosition(xp)
- {
- var pos;
- if(xp < 42)
- {
- pos = 1;
- }
- else if(xp >= 42 && xp < 74)
- {
- pos = 2;
- }
- else if(xp >= 74 && xp < 106)
- {
- pos = 3;
- }
- else if(xp >= 106 && xp < 138)
- {
- pos = 4;
- }
- else
- {
- pos = 5;
- }
- return pos;
- }
- function hitGoalPost()
- {
- _root.goalpost_mc.gotoAndPlay("shake");
- }
- function goal()
- {
- if(_root.runtime.isThisAGoal)
- {
- _root.runtime.score = _root.runtime.score + 1;
- _root.kicker_mc.gotoAndPlay("goal");
- _root.sound_mc.gotoAndPlay("goal");
- _root.crowd_mc.gotoAndPlay("goal");
- }
- else
- {
- _root.kicker_mc.gotoAndStop("missed");
- _root.sound_mc.gotoAndPlay("missed");
- if(_root.runtime.flag == "in")
- {
- _root.runtime.saves = _root.runtime.saves + 1;
- }
- else
- {
- _root.runtime.misses = _root.runtime.misses + 1;
- }
- }
- }
- function nextKick()
- {
- _root.runtime.kicks = _root.runtime.kicks + 1;
- if(_root.runtime.kicks < _root.runtime.totalKicks)
- {
- _root.resetKick();
- }
- else
- {
- _root.updateDisplay();
- var comment = Math.floor(_root.runtime.score / 2);
- comment = Math.min(comment,5);
- _root.comments_txt = _root.runtime.scoreComments[comment];
- _root.gotoAndPlay("end");
- }
- }
- function ballCheckGoal()
- {
- if(!_root.runtime.isThisAGoal)
- {
- _root.ball_mc.gotoAndPlay("save" + _root.runtime.pos);
- }
- }
- function updateDisplay()
- {
- _root.score_txt = _root.runtime.score;
- _root.kicks_txt = _root.runtime.kicks;
- _root.misses_txt = _root.runtime.misses;
- _root.saves_txt = _root.runtime.saves;
- }
- function init()
- {
- _root.gameID = "cheeky";
- _root.runtime = new Object();
- _root.runtime.pos = 0;
- _root.runtime.score = 0;
- _root.runtime.saves = 0;
- _root.runtime.misses = 0;
- _root.runtime.kicks = 0;
- _root.runtime.totalKicks = 12;
- _root.runtime.winChance = 0.7;
- _root.runtime.flag = "out";
- _root.runtime.scoreComments = new Array();
- _root.runtime.scoreComments[0] = "Let{invalid_utf8=146}s pretend that was the warm up... Quick go again!";
- _root.runtime.scoreComments[1] = "Even great footballers have to start somewhere!";
- _root.runtime.scoreComments[2] = "I think we need to teach this keeper a lesson!";
- _root.runtime.scoreComments[3] = "Not bad... Keep the training up!";
- _root.runtime.scoreComments[4] = "You show great potential - Keep up the good work!";
- _root.runtime.scoreComments[5] = "Goooooaaaaallllllll!!!! Cheeky is the champion!";
- _root.runtime.crowdBg_sound = new Sound();
- _root.runtime.crowdBg_sound.attachSound("crowdBg");
- _root.runtime.crowdBg_sound.setVolume(100);
- _root.runtime.crowdBg_sound.start(0,10000);
- _root.updateDisplay();
- _root.resetKick();
- }
- stopAllSounds();
- init();
- stop();
-